﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Telecom.Data;

namespace Telecom.Service
{
    public class LoaiLapDatService
    {
        private readonly EntitiesTelecom dbContext = new EntitiesTelecom();

        public LoaiLapDatService()
        {
            dbContext.Configuration.LazyLoadingEnabled = false;
            dbContext.Configuration.ProxyCreationEnabled = false;
        }

        public List<LOAI_LAPDAT> getList()
        {
            dbContext.Configuration.LazyLoadingEnabled = false;
            try
            {
                return dbContext.LOAI_LAPDAT.ToList();
            }
            catch (Exception e)
            {
                List<LOAI_LAPDAT> _listRe = new List<LOAI_LAPDAT>();
                return _listRe;
            }
        }

        public LOAI_LAPDAT GetbyId(string ma)
        {
            dbContext.Configuration.LazyLoadingEnabled = false;
            try
            {
                return dbContext.LOAI_LAPDAT.Where(p => p.MA == ma).First();
            }
            catch (Exception e)
            {
                LOAI_LAPDAT _listRe = new LOAI_LAPDAT();
                return _listRe;
            }
        }
    }
}
